public class Animal {
    private String name;
    public int age;
    public String sex;
    String color;//默认权限   包访问权限

    public void setName(String name){
        this.name = name;
    }

    /*public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }*/

    public Animal(){

    }

    public void eat(){
        System.out.println(this.name + " 吃饭");
    }
    public void sleep(){
        System.out.println(this.name + " 睡觉");
    }

    //类的调用者写的
    /*public static void main(String[] args) {
        Animal animal = new Animal();
        animal.name = "旺财!";
        animal.eat();
    }*/
}
